package com.ssy.lingxi.after.sale.controller;

import com.ssy.lingxi.after.sale.api.model.vo.request.*;
import com.ssy.lingxi.after.sale.api.model.vo.response.ReturnGoodsDetailListResponse;
import com.ssy.lingxi.after.sale.api.model.vo.response.ReturnGoodsInfoVO;
import com.ssy.lingxi.after.sale.api.model.vo.response.ReturnGoodsTaxVO;
import com.ssy.lingxi.after.sale.service.IReturnGoodsService;
import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.Wrapper;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * @menu 售后能力-售后退货-内部接口
 * @author 伍将
 * @date 2020/9/17
 * @version 2.0.0
 */
@RestController
@RequestMapping("/as/feign/returnGoods")
public class ReturnGoodsFeignController extends BaseController {

    @Resource
    private IReturnGoodsService returnGoodsService;

    /**
     * 新增退货发货单
     * @author 伍将
     * @date 2020/9/24
     **/
    @RequestMapping("/addReturnDeliveryGoods")
    public Wrapper<Long> addReturnDeliveryGoods(@RequestBody @Valid ReturnAddDeliveryGoodsVO addVO) {
        //return returnGoodsService.addReturnDeliveryGoods(null,addVO);
        return null;
    }

    /**
     * 删除退货发货单
     * @author 伍将
     * @date 2020/9/29
     **/
    @RequestMapping("/deleteReturnDeliveryGoods")
    public Wrapper<Void> deleteReturnDeliveryGoods(@RequestBody CommonIdVO commonIdVO) {
        return returnGoodsService.deleteReturnDeliveryGoods(commonIdVO.getDataId());
    }

    /**
     * 审核退货发货单
     * @author 伍将
     * @date 2020/12/22
     **/
    @RequestMapping("/verifyReturnDeliveryGoods")
    public Wrapper<Void> verifyReturnDeliveryGoods(@RequestBody VerifyDeliveryVO verifyVO) {
        return returnGoodsService.verifyReturnDeliveryGoods(verifyVO);
    }

    /**
     * 新增退货物流
     * @author 伍将
     * @date 2020/9/24
     **/
    @RequestMapping("/addReturnLogistics")
    public Wrapper<Void> addReturnLogistics(@RequestBody @Valid AddLogisticsVO addVO) {
        return returnGoodsService.addReturnLogistics(addVO);
    }

    /**
     * 删除退货物流
     * @author 伍将
     * @date 2020/9/29
     **/
    @RequestMapping("/deleteReturnLogistics")
    public Wrapper<Void> deleteReturnLogistics(@RequestBody CommonIdVO commonIdVO) {
        return returnGoodsService.deleteReturnLogistics(commonIdVO.getDataId());
    }

    /**
     * 审核退货物流单
     * @author 伍将
     * @date 2020/9/24
     **/
    @RequestMapping("/verifyReturnLogistics")
    public Wrapper<Void> verifyReturnLogistics(@RequestBody VerifyLogisticsVO verifyVO) {
        return returnGoodsService.verifyReturnLogistics(verifyVO);
    }

    /**
     * 新增退货入库单
     * @author 伍将
     * @date 2020/9/24
     **/
    @RequestMapping("/addReturnGoodsStorage")
    public Wrapper<Void> addReturnGoodsStorage(@RequestBody @Valid ReturnAddStorageVO addVO) {
        return returnGoodsService.addReturnGoodsStorage(addVO);
    }

    /**
     * 删除退货入库单
     * @author 伍将
     * @date 2020/9/29
     **/
    @RequestMapping("/deleteReturnGoodsStorage")
    public Wrapper<Void> deleteReturnGoodsStorage(@RequestBody CommonIdVO commonIdVO) {
        //return returnGoodsService.deleteReturnGoodsStorage(commonIdVO.getDataId());
        return null;
    }

    /**
     * 审核退货入库单
     * @author 伍将
     * @date 2020/12/22
     **/
    @RequestMapping("/verifyReturnGoodsStorage")
    public Wrapper<Void> verifyReturnGoodsStorage(@RequestBody @Valid VerifyDeliveryVO verifyVO) {
        //return returnGoodsService.verifyReturnGoodsStorage(verifyVO);
        return null;
    }

    /**
     * 查询退货订单发票
     * @author 伍将
     * @date 2021/1/27
     **/
    @RequestMapping(value = "/getOrderList", method = RequestMethod.GET)
    public Wrapper<List<String>> getOrderList(@RequestParam("applyNo") String applyNo) {
        return returnGoodsService.getOrderList(applyNo);
    }

    /**
     * 根据合同id,查询合同下的退款单列表
     * @author ds
     * @date 2021/1/27
     **/
    @RequestMapping(value = "/getOrderListByContractId")
    public Wrapper<List<ReturnGoodsDetailListResponse>> getOrderListByContractId(@RequestBody @Valid ReturnListGoodsDetailVO vo) {
        return returnGoodsService.getOrderListByContractId(vo);
    }

    /**
     * 查询是否允许支付
     * @author 伍将
     * @date 2021/1/28
     **/
    @RequestMapping(value = "/isAllowPay")
    public Wrapper<Boolean> isAllowPay(@RequestBody @Valid AllowPayVO payVO) {
        return returnGoodsService.isAllowPay(payVO);
    }

    /**
     * 根据退货订单ids,查询退货订单信息（状态）列表
     * @author ds
     * @date 2021/4/9
     **/
    @RequestMapping(value = "/getOrderInfoListByIds")
    public Wrapper<List<ReturnGoodsInfoVO>> getOrderInfoListByIds(@RequestBody List<Long> returnGoodsIds) {
        return returnGoodsService.getOrderInfoListByIds(returnGoodsIds);
    }

    /**
     * 根据退货订单ids,查询退货订单信息（状态）列表
     * @author ds
     * @date 2021/4/9
     **/
    @RequestMapping(value = "/getOrderInfoListByIdsAndSkuIds")
    public Wrapper<List<ReturnGoodsTaxVO>> getOrderInfoListByIdsAndSkuIds(@RequestBody ReturnDetailReqVO req) {
        return returnGoodsService.getOrderInfoListByIdsAndSkuIds(req);
    }
}
